<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
 <head>
  <title>车辆主数据</title>
  <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  <link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
  <script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.js"></script>
  <script type="text/javascript">
  //编写自定义JS代码
  </script>
 </head>
 <body>
  <t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" action="tCarInfoController.do?doAdd" callback="jeecgFormFileCallBack@Override">
					<input id="id" name="id" type="hidden" value="${tCarInfoPage.id }"/>
		<table style="width: 600px;" cellpadding="0" cellspacing="1" class="formtable">
				<tr>
					<td align="right">
						<label class="Validform_label">
							车牌号:
						</label>
					</td>
					<td class="value">
					     	 <input id="carNum" name="carNum" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">车牌号</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							车型:
						</label>
					</td>
					<td class="value">
					     	 <input id="carType" name="carType" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">车型</label>
						</td>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							荷载人数:
						</label>
					</td>
					<td class="value">
					     	 <input id="carHzrs" name="carHzrs" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">荷载人数</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							所需驾照:
						</label>
					</td>
					<td class="value">
							  <t:dictSelect field="carJiashizheng" type="list"  typeGroupCode="jiashizh"  defaultVal="${tCarInfoPage.carJiashizheng}" hasLabel="false"  title="所需驾照" ></t:dictSelect>     
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">所需驾照</label>
						</td>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							购买金额:
						</label>
					</td>
					<td class="value">
					     	 <input id="carBuyMoney" name="carBuyMoney" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">购买金额</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							购置时间:
						</label>
					</td>
					<td class="value">
							   <input id="carBuyDate" name="carBuyDate" type="text" style="width: 150px" class="Wdate" onClick="WdatePicker()"  ignore="ignore" />    
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">购置时间</label>
						</td>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							车架号:
						</label>
					</td>
					<td class="value">
					     	 <input id="carVmi" name="carVmi" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">车架号</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							发动机号:
						</label>
					</td>
					<td class="value">
					     	 <input id="carEngineno" name="carEngineno" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">发动机号</label>
						</td>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							排气量升:
						</label>
					</td>
					<td class="value">
					     	 <input id="carPaiqiliang" name="carPaiqiliang" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">排气量升</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							载重吨:
						</label>
					</td>
					<td class="value">
					     	 <input id="carZaizhong" name="carZaizhong" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">载重吨</label>
						</td>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							燃油类型:
						</label>
					</td>
					<td class="value">
							  <t:dictSelect field="carFuel" type="list"  typeGroupCode="car_fuel"  defaultVal="${tCarInfoPage.carFuel}" hasLabel="false"  title="燃油类型" ></t:dictSelect>     
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">燃油类型</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							驾驶员:
						</label>
					</td>
					<td class="value">
					     	 <input id="carDriver" name="carDriver" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">驾驶员</label>
						</td>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							年检日期1:
						</label>
					</td>
					<td class="value">
							   <input id="njRiqi1" name="njRiqi1" type="text" style="width: 150px" class="Wdate" onClick="WdatePicker()"  ignore="ignore" />    
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">年检日期1</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							年检日期2:
						</label>
					</td>
					<td class="value">
							   <input id="njRiqi2" name="njRiqi2" type="text" style="width: 150px" class="Wdate" onClick="WdatePicker()"  ignore="ignore" />    
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">年检日期2</label>
						</td>
					</tr>
				<%--<tr>--%>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--状态:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="carStatus" name="carStatus" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">状态</label>--%>
						<%--</td>--%>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--备用1:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="by1" name="by1" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">备用1</label>--%>
						<%--</td>--%>
					<%--</tr>--%>
				<%--<tr>--%>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--备用2:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="by2" name="by2" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">备用2</label>--%>
						<%--</td>--%>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--备用3:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="by3" name="by3" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">备用3</label>--%>
						<%--</td>--%>
					<%--</tr>--%>
				<%--<tr>--%>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--备用4:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="by4" name="by4" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">备用4</label>--%>
						<%--</td>--%>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--备用5:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="by5" name="by5" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">备用5</label>--%>
						<%--</td>--%>
					<%--</tr>--%>
				<tr>
					<td align="right">
						<label class="Validform_label">
							厂牌型号:
						</label>
					</td>
					<td class="value">
					     	 <input id="carChpxh" name="carChpxh" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">厂牌型号</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							车辆外廓尺寸:
						</label>
					</td>
					<td class="value">
					     	 <input id="carClwgchc" name="carClwgchc" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">车辆外廓尺寸</label>
						</td>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							办证时间:
						</label>
					</td>
					<td class="value">
							   <input id="carBzsj" name="carBzsj" type="text" style="width: 150px" class="Wdate" onClick="WdatePicker()"  ignore="ignore" />    
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">办证时间</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							发动机功率:
						</label>
					</td>
					<td class="value">
					     	 <input id="carFdjgl" name="carFdjgl" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">发动机功率</label>
						</td>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							核定人数:
						</label>
					</td>
					<td class="value">
					     	 <input id="carHdrsh" name="carHdrsh" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">核定人数</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							驱动形式:
						</label>
					</td>
					<td class="value">
							  <t:dictSelect field="carQdxsh" type="list"  typeGroupCode="qdxsh"  defaultVal="${tCarInfoPage.carQdxsh}" hasLabel="false"  title="驱动形式" ></t:dictSelect>     
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">驱动形式</label>
						</td>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							变速器形式:
						</label>
					</td>
					<td class="value">
							  <t:dictSelect field="carBsqxsh" type="list"  typeGroupCode="bsqxsh"  defaultVal="${tCarInfoPage.carBsqxsh}" hasLabel="false"  title="变速器形式" ></t:dictSelect>     
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">变速器形式</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							车身颜色:
						</label>
					</td>
					<td class="value">
					     	 <input id="carCsys" name="carCsys" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">车身颜色</label>
						</td>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							承保公司:
						</label>
					</td>
					<td class="value">
					     	 <input id="carChbgs" name="carChbgs" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">承保公司</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							总质量:
						</label>
					</td>
					<td class="value">
					     	 <input id="carZhil" name="carZhil" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">总质量</label>
						</td>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							照片:
						</label>
					</td>
					<td class="value">
								<table></table>
								<div class="form jeecgDetail"> 
									<script type="text/javascript">
										var serverMsg="";
										$(function(){
											$('#carPic').uploadify({
												buttonText:'添加图片',
												auto:false,
												progressData:'speed',
												multi:true,
												height:25,
												overrideEvents:['onDialogClose'],
												fileTypeDesc:'文件格式:',
												queueID:'filediv_carPic',
												fileSizeLimit:'15MB',
												swf:'plug-in/uploadify/uploadify.swf',	
												uploader:'cgUploadController.do?saveFiles&jsessionid='+$("#sessionUID").val()+'',
												onUploadStart : function(file) { 
													var cgFormId=$("input[name='id']").val();
													$('#carPic').uploadify("settings", "formData", {
														'cgFormId':cgFormId,
														'cgFormName':'t_car_info',
														'cgFormField':'CAR_PIC'
													});
												} ,
												onQueueComplete : function(queueData) {
													 var win = frameElement.api.opener;
													 win.reloadTable();
													 win.tip(serverMsg);
													 frameElement.api.close();
												},
												onUploadSuccess : function(file, data, response) {
													var d=$.parseJSON(data);
													if(d.success){
														var win = frameElement.api.opener;
														serverMsg = d.msg;
													}
												},
												onFallback: function() {
								                    tip("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试")
								                },
								                onSelectError: function(file, errorCode, errorMsg) {
								                    switch (errorCode) {
								                    case - 100 : tip("上传的文件数量已经超出系统限制的" + $('#file').uploadify('settings', 'queueSizeLimit') + "个文件！");
								                        break;
								                    case - 110 : tip("文件 [" + file.name + "] 大小超出系统限制的" + $('#file').uploadify('settings', 'fileSizeLimit') + "大小！");
								                        break;
								                    case - 120 : tip("文件 [" + file.name + "] 大小异常！");
								                        break;
								                    case - 130 : tip("文件 [" + file.name + "] 类型不正确！");
								                        break;
								                    }
								                },
								                onUploadProgress: function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) {}
											});
										});
									</script>
									<span id="file_uploadspan"><input type="file" name="carPic" id="carPic" /></span> 
								</div> 
								<div class="form" id="filediv_carPic"></div>
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">照片</label>
						</td>
				<td align="right">
					<label class="Validform_label">
					</label>
				</td>
				<td class="value">
				</td>
					</tr>
				
				
			</table>
		</t:formvalid>
 </body>
  <script src = "webpage/com/yserp/car/tCarInfo.js"></script>		
	  	<script type="text/javascript">
	  		function jeecgFormFileCallBack(data){
	  			if (data.success == true) {
					uploadFile(data);
				} else {
					if (data.responseText == '' || data.responseText == undefined) {
						$.messager.alert('错误', data.msg);
						$.Hidemsg();
					} else {
						try {
							var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'), data.responseText.indexOf('错误信息'));
							$.messager.alert('错误', emsg);
							$.Hidemsg();
						} catch(ex) {
							$.messager.alert('错误', data.responseText + '');
						}
					}
					return false;
				}
				if (!neibuClickFlag) {
					var win = frameElement.api.opener;
					win.reloadTable();
				}
	  		}
	  		function upload() {
					$('#carPic').uploadify('upload', '*');	
			}
			
			var neibuClickFlag = false;
			function neibuClick() {
				neibuClickFlag = true; 
				$('#btn_sub').trigger('click');
			}
			function cancel() {
					$('#carPic').uploadify('cancel', '*');
			}
			function uploadFile(data){
				if(!$("input[name='id']").val()){
					if(data.obj!=null && data.obj!='undefined'){
						$("input[name='id']").val(data.obj.id);
					}
				}
				if($(".uploadify-queue-item").length>0){
					upload();
				}else{
					if (neibuClickFlag){
						alert(data.msg);
						neibuClickFlag = false;
					}else {
						var win = frameElement.api.opener;
						win.reloadTable();
						win.tip(data.msg);
						frameElement.api.close();
					}
				}
			}
	  	</script>
